﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WoSoft.PACS.Data.CheckData;
using System.Runtime.InteropServices;
using System.Reflection;
using System.IO;
using Microsoft.Reporting.WinForms;

namespace WoSoft.PACS.Win.Forms.SubForms
{
    public partial class FrmReportView : WoSoft.PACS.Win.FrmBase
    {
        string _checkAppID;
        string _checkAppType;
        //检查访问对象
        private CheckApp _checkapp;

        public FrmReportView()
        {
            InitializeComponent();
        }

        public FrmReportView(string checkAppID,string checkAppType)
        {
            InitializeComponent();
            _checkAppID = checkAppID;
            _checkAppType = checkAppType;
        }

        private void FrmReportView_Load(object sender, EventArgs e)
        {
            _checkapp = new CheckApp();

            int imgCounts = _checkapp.ImgCounts(this._checkAppID);
            if (imgCounts == 1)
                reportViewer.LocalReport.ReportPath = Application.StartupPath + @"/RdlcReport/" + this._checkAppType + "1.rdlc";
            else if (imgCounts == 2)
                reportViewer.LocalReport.ReportPath = Application.StartupPath + @"/RdlcReport/" + this._checkAppType + "2.rdlc";
            else if (imgCounts == 3)
                reportViewer.LocalReport.ReportPath = Application.StartupPath + @"/RdlcReport/" + this._checkAppType + "3.rdlc";
            else
                reportViewer.LocalReport.ReportPath = Application.StartupPath + @"/RdlcReport/" + this._checkAppType + "4.rdlc";

            DataTable dt = _checkapp.GetReportResult(this._checkAppID);
            reportViewer.LocalReport.EnableExternalImages = true;
            reportViewer.LocalReport.DataSources.Clear();
            reportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet检查报告记录", dt));
            this.reportViewer.RefreshReport();

            this.reportViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);

        }
    }
}
